

var BOSS = function () {

    var globalPath = '/';
    return {
    	init: function () {},
	    remoteCall: function (url,element,data,msg) {
	    	$('#save_update_message').hide();
	    	
	    	Metronic.blockUI();
			$.ajax({
			  url: globalPath + url,
			  cache: false,
			  type:"post",
			  data:data,
			  success:function(result) {	//回调函数，result，返回值
              },
			  error:function(xhr,data){
				  Metronic.unblockUI();
				  $(".alert").hide();
				  Metronic.alert({'message':$.parseJSON(xhr.responseText).errors});
			  }
			}).done(function( html ) {
			  	Metronic.unblockUI();
			    $( element ).html( html );
			    $(".alert").hide();
			    if(data.update == 'update'){
			    	Metronic.alert({'message':'更新成功！'});
			    	Metronic.init(); 
			    }else if(data.spadd == 'spadd'){
			    	//不显示绿条提示信息
			    	Metronic.alert({'message':'添加成功！'});
			    	Metronic.init(); 
			    }
			    else if(data.status == 'up'){
			    	Metronic.alert({'message':'显示成功！'});
			    	Metronic.init(); 
			    }else if(data.status == 'down'){
			    	Metronic.alert({'message':'隐藏成功！'});
			    	Metronic.init(); 
			    }else if(data.status == 'turn'){
			    	Metronic.alert({'message':'转移成功！'});
			    	Metronic.init(); 
			    }else if(data.back == 'back'){
			    	Metronic.alert({'message':'还原成功！'});
			    	Metronic.init(); 
			    }else if(data.statusline == 'statusline'){
			    	Metronic.alert({'message':'修改成功！'});
			    	Metronic.init(); 
			    }else{
			    	Metronic.alert({'message':'删除成功！'});
			    	Metronic.init(); 
			    }
			    
			  });   	
	    },
	    remoteLogin: function (url,data) {
			$.ajax({
			  url: globalPath + url,
			  type:"post",
			  data:data,
			  success:function(result) {
				 //回调函数，result，返回值
				  if(result == "false"){
					  $(".wrong_password").show();
				  }else{
					  location.href ="/admin";
				  }
              },
			  error:function(xhr,data){
			  }
			});
			    	
	    }
    };
}();
